package mobi.hami.huapin.dao;

import java.util.List;

import mobi.hami.huapin.daobase.CrudMapper;
import mobi.hami.huapin.model.OpinionLeader;
import mobi.hami.huapin.model.SkuAttribute;
import mobi.hami.huapin.model.SkuAttributeExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

@Repository
public interface SkuAttributeMapper extends CrudMapper<SkuAttribute> {
    @Select("<script>"
            + "SELECT * FROM sku_attribute "
            + "<where>"
            + "<if test='_parameter >0'>AND productid = #{_parameter}</if>"
            + "</where>"
            + "</script>")
    List<SkuAttribute> getAttributeByProductid(Integer  productid);

    /**
     * 用户前端查询 销售属性
     * @param spu_id
     * @return
     */
    @Select("SELECT id,productid,name from sku_attribute where productid = #{spu_id} order by displayorder asc  ")
    public List<SkuAttribute> getListForUser(long spu_id);

}